package com.kkw.shoppingmall.product.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.File;

/**
 * @author Kevin
 * @date 2021-06-05
 **/
@Configuration
public class MyRedissonConfig {
    /**
     * 所有对Redisson的使用都是通过RedissonClient对象
     * @return
     */
    @Bean(destroyMethod = "shutdown")
    public RedissonClient redisson() {
        // 1. Create config object
        Config config = new Config();
        config.useSingleServer()
//                .setAddress("redis://192.168.56.10:6379");
                .setAddress("redis://127.0.0.1:6379");

        return Redisson.create(config);
    }
}
